import Router from "@koa/router";
import userRouter from "./user.router";
import authRouter from "./auth.router";
import categoryRouter from "./category.router";
import imageRouter from "./image.router";
import dishesRouter from "./dishes.router";
import menuRouter from "./menu.router";
import wishRouter from "./wish.router";

const router = new Router();

// 健康检查接口
router.get("/health", (ctx) => {
  ctx.status = 200;
  ctx.body = {
    status: "ok",
    message: "Server is running",
  };
});

// 测试接口
router.get("/", (ctx) => {
  ctx.status = 200;
  ctx.body = {
    message: "Hello World!",
  };
});

// 挂载所有路由
router.use(userRouter.routes());
router.use(userRouter.allowedMethods());

router.use(authRouter.routes());
router.use(authRouter.allowedMethods());

router.use(categoryRouter.routes());
router.use(categoryRouter.allowedMethods());

router.use(imageRouter.routes());
router.use(imageRouter.allowedMethods());

router.use(dishesRouter.routes());
router.use(dishesRouter.allowedMethods());

router.use(menuRouter.routes());
router.use(menuRouter.allowedMethods());

router.use(wishRouter.routes());
router.use(wishRouter.allowedMethods());

export default router;
